
import axios from 'axios'

const baseUrl  = 'http://localhost:5000'

export const addItem = async (obj)=>{
  console.log(obj)
  let res = await axios.post(`${baseUrl}/books`,obj)
  return res.data
}

export const delBook = async (id)=>{
  let res=await axios.delete(`${baseUrl}/books/${id}`)
  return res.data
}

export const getAll = async ()=>{
let res=await axios.get(`${baseUrl}/books`)
 return res.data 
}

export const editItem = async (id,obj)=>{
  let res = await axios.put(`${baseUrl}/books/${id}`,obj)
  return res.data
}

export const getById = async (id)=>{
  let res = await axios.get(`${baseUrl}/books/${id}`)
  return res.data
}



